<template>
	<view style="width: 100%; height: 100%; background-color: #f7f7f7;">
		
		<view class="my">
			<view class="my_body_mian">
				<view class="top">
					<view class="logs" @click="tologin">
						<view class="imgs">
							<img style='width: 80px; height: 80px; border-radius: 50%;' :src="userlist.imglog" alt="">
						</view>
						<view class="textname">
							{{userlist.name}}
						</view>
					</view>
				</view>
				<view class="main">
					<view class="main_top">
						<view class="main_top_left">
							购物订单
						</view>
						<view @click="ontoorders()" class="main_top_reft">
							我的订单
						</view>
					</view>
					<view class="main_butt">
						<view class="boot_dindan">

							<view style="text-align: center;" v-for="(item,index) in dindanBOX"
								@click="ontoorders(item.id)">
								<view>
									<image style="width: 35px; height: 35px;" :src="item.src" mode=""></image>
								</view>
								<P>{{item.name}}</P>
							</view>

						</view>
					</view>
				</view>
<!-- 				<view class="boff">
					<view class="main_top">
						<view class="main_top_left">
							经销服务
						</view>
					</view>
					<view class="main_butt">
						<view class="boot_jingxiao">
							<view style="text-align: center; margin-right: 10%;" v-for="(item,index) in jinxiao"
								@click="">
								<view>
									<image style="width: 35px; height: 35px;" :src="item.src" mode=""></image>
								</view>
								<P style="font-size: 13px;">{{item.name}}</P>
							</view>
						</view>
					</view>
				</view> -->
				
				
				
				<view class="boff">
					<view class="main_top">
						<view class="main_top_left">
							用户服务
							
						</view>
					</view>
					<view class="main_butt">
						<view class="boot_jingxiao">
<!-- 							<view style="text-align: center; margin-right: 10%;" @click="">
								<view>
									<image style="width: 35px; height: 35px;" src="../../static/zj.png" mode=""></image>
								</view>
								<P style="font-size: 13px;">我的足迹</P>
							</view>
							
							<view style="text-align: center; margin-right: 10%;" @click="">
								<view>
									<image style="width: 35px; height: 35px;" src="../../static/sc.png" mode=""></image>
								</view>
								<P style="font-size: 13px;">我的收藏</P>
							</view> -->
							
							<view style="text-align: center; margin-left: 20px;"@click="toadds()">
								<view>
									<image style="width: 35px; height: 35px;" src="../../static/my.png" mode=""></image>
								</view>
								<P style="font-size: 13px;">地址管理</P>
							</view>
						</view>
					</view>
				</view>
				
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userlist:{
					imglog:'../../static/my.png',
					name:'点击登录'
				},
				//购物订单
				dindanBOX: [{
					// 已取消,1预订单,2待支付,3支付中,4已支付,5已发货,6已完成)
						id: 1,
						name: '待付款',
						src: '../../static/df.png'
					},
					{
						id: 2,
						name: '待发货',
						src: '../../static/dfh.png'
					}, {
						id: 3,
						name: '待收货',
						src: '../../static/ds.png'
					}, {
						id: 4,
						name: '订单完成',
						src: '../../static/dindanwanc.png'
					},
				],
				//经销服务
				jinxiao: [
					// {
					// 	id: 1,
					// 	name: '进货经销商',
					// 	src: '../../static/sao.png'
					// },
					// {
					// 	id: 1,
					// 	name: '销售码',
					// 	src: '../../static/sao.png'
					// },

				],

				show:false


			}
		},
		onShow() {
			this.getuserlist()
		},
		methods: {
			tologin(){
				uni.navigateTo({
					url:"../loginfor/loginfor"
				})
			},
			
			ontoorders(id) {
				if (this.name == '') {
					this.shouquan = true
				} else {
					uni.navigateTo({
						url: '../orderdetails/orderdetails?id=' + id
					})
				}
			},
			
			toadds(){
				uni.navigateTo({
					url:'../adds/adds'
				})
			},
			
			getuserlist() {
				let cachedata = this.$http.myCache('userdata')
				if (cachedata) {
					console.log(cachedata.token);
					uni.setStorage({
						data:cachedata.token,
						key:"session_key"
					})
					console.log("ssskey");
					this.userlist.imglog = cachedata.headimg
					this.userlist.name = cachedata.nickname
				} else {
					console.log("已失效");
					this.userlist.imglog = '../../static/my.png'
					this.userlist.name = "点击登录"
				}
				
				console.log(this.userlist);
			},
		}
	}
</script>

<style>
	.my {
		width: 100%;
		height: 100%;
	}

	.my_body_mian {
		width: 100%;
		height: 100%;
	}

	.top {
		margin: 0 auto;
		background-color: #3c9cff;
		display: flex;
		justify-content: center;
		height: 35%;
	}

	.logs {
		display: flex;
		justify-content: space-between;
		flex-direction: column;
		height: 110px;
		margin-top: 10%;
	}

	.imgs {
		width: 80px;
		height: 80px;
	}

	.textname {
		color: #fff;
		font-weight: 600;
		text-align: center;
	}

	.main {
		width: 100%;
		height: 23%;
		margin-top: 15px;
		background-color: #fff;
		display: flex;
		justify-content: center;
		flex-direction: column;
	}

	.main_top {
		padding: 0 0 0 10px;
		color: #000;
		font-weight: 600;
		font-size: 14px;
		height: 35%;
		display: flex;
		justify-content: space-between;
		border-bottom: 1px solid #f7f7ff;
	}

	.main_top_left {
		display: flex;
		justify-content: center;
		flex-direction: column;
		text-align: center;
	}

	.main_top_reft {
		border-radius: 20px 0 0 20px;
		text-align: center;
		padding: 15px;
		display: flex;
		justify-content: center;
		flex-direction: column;
		margin: 5px 0 5px 0;
		color: #fff;
		background-color: #3c9cff;
	}

	.main_butt {
		padding: 10px 10px 0 10px;
		height: 70%;
	}
	
	.boff{
		background-color: #fff;
		margin-top: 15px;
		height: 23%;
	}

	.boot_dindan {
		display: flex;
		justify-content: space-around;
	}
	.boot_jingxiao {
		display: flex;
	}

	.boot_dindan>view {
		font-size: 13px;
		margin: 20px 0 20px 0;
		display: flex;
		justify-content: center;
		flex-direction: column;
	}
</style>
